package com.movitech.mobile.cz.base.modules.activiti.service;

import java.util.List;

import org.activiti.engine.HistoryService;
import org.activiti.engine.history.HistoricTaskInstance;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

@Service
public class ActivitiHistoryService {
	protected Logger logger = LoggerFactory.getLogger(getClass());

	@Autowired
	private HistoryService historyService;

	/**
	 * 查询历史任务-对应表：act_hi_taskinst
	 * @param processInstanceId
	 */
	public List<HistoricTaskInstance> findHistoricTaskListByProcessInstanceId(String processInstanceId) {
		return historyService.createHistoricTaskInstanceQuery().processInstanceId(processInstanceId).list();
	}
	
	/**
	 * 查询历史任务-对应表：act_hi_taskinst
	 * @param userId
	 */
	public List<HistoricTaskInstance> findHistoricTaskListByUserId(String userId) {
		return historyService.createHistoricTaskInstanceQuery().taskAssignee(userId).list();
	}
}
